import {View, Text, TouchableOpacity} from 'react-native';
import React from 'react';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import UserScreen from '../screens/users';
import AboutScreen from '../screens/users/about';
import Login from '../screens/NoAuth/login';
import Register from '../screens/NoAuth/register';
// 栈路由 类似于网页的history路由
const Stack = createNativeStackNavigator();
export default function HomeStack() {
  return (
    <Stack.Navigator>
      <Stack.Screen
        name="User"
        component={UserScreen}
        options={{
          title: '个人中心',
          headerStyle: {
            backgroundColor: 'tomato',
          },
          headerRight: () => {
            return (
              <TouchableOpacity onPress={() => alert('Hello')}>
                <Text>扫码</Text>
              </TouchableOpacity>
            );
          },
        }}
      />
      <Stack.Screen
        name="About"
        component={AboutScreen}
        options={{title: '关于', headerStyle: {backgroundColor: '#fff'}}}
      />
      <Stack.Screen name="Login" component={Login} />
      <Stack.Screen name="Register" component={Register} />
    </Stack.Navigator>
  );
}
